home *** CD-ROM | disk | FTP | other *** search
- '==========================================================
- '
- ' Module - MODGEN.BAS
- '
- ' Module Prefix - None
- '
- ' Author - Peter J. Morris. TMS Ltd.
- '
- ' Date Written : #### Date - 16/11/94 Time - 03:11
- '
- ' Purpose - Common support module for VBITS demo code.
- '
- ' Revisions
- ' BY WHY AFFECTED
- ' Peter J. Morris. TMS Ltd. Original code.
- '
- '==========================================================
-
-
- Option Explicit
-
- '==========================================================
- '
- ' Function - DoLabels
- '
- ' Author - Peter J. Morris. TMS Ltd.
- '
- ' Date Written: #### Date - 16/11/94 Time - 03:11
- '
- ' Purpose - See function purpose.
- '
- ' Revisions:
- ' BY WHY AFFECTED
- ' Peter J. Morris. TMS Ltd. Original code.
- '
- '
- ' INPUTS - frm -> Form to use.
- '
- '
- ' OUTPUTS - None
- '
- '==========================================================
- Sub DoLabels (frm As Form)
- '==========================================================
- '
- ' Form: MODGEN.BAS Procedure: DoLabels
- '
- ' Author - Peter J. Morris. TMS Ltd.
- ' Template fitted: #### Date - 16/11/94 Time - 03:11
- '
- ' Copyright and status if any: Copyright ⌐ TMS 1994,1995
- ' All rights reserved. Status @BLUE@TMS.DEMO@COLD
- '
- ' Purpose/Description In brief:
- ' Sub used to reset all Label controls on a given form.
- '
- '=========================================================
-
- ' Set up general error handler
-
- On Error GoTo Error_DoLabels:
-
- ' ========== Code Starts.==========
-
-
- ' Control variable.
- Dim cp As Control
- Dim nLoop As Integer
-
- ' For every control 'in' a form do...
- For nLoop = 0 To frm.Controls.Count - 1
-
- Set cp = frm.Controls(nLoop)
-
- ' If it's a label...
- If TypeOf cp Is Label Then
- ' Turn off its border and reset & set AutoResize. This makes sure that
- ' the label is ALWAYS big enough to take its text irrespective of the
- ' device driver used. BorderStyle = 0 turns off the label's border, we
- ' usually leave on the label's border at design time so that we can
- ' see/place it more easily.
- cp.BorderStyle = 0
- cp.AutoSize = False
- cp.AutoSize = True
- End If
-
- Next
-
-
- ' ========== Code Ends .==========
-
- Exit Sub
-
- ' Error handler
- Error_DoLabels:
-
- ' Call general error handler
-
- ErrorHandler "MODGEN.BAS/DoLabels", Err, Error$
-
- ' Default resume behaviour: exit this sub/func
-
- Resume Exit_DoLabels:
-
- Exit_DoLabels:
-
-
- End Sub
-
- '==========================================================
- '
- ' Function - ErrorHandler
- '
- ' Author - Peter J. Morris. TMS Ltd.
- '
- ' Date Written: #### Date - 16/11/94 Time - 03:11
- '
- ' Purpose - See function purpose.
- '
- ' Revisions:
- ' BY WHY AFFECTED
- ' Peter J. Morris. TMS Ltd. Original code.
- '
- '
- ' INPUTS - sModuleInfo -> Name of module and routine in which
- ' error occurred.
- ' nErrNo -> Visual Basic 'Err' error code for error.
- ' sErrorText -> Visual Basic 'Error$' error text for error.
- '
- '
- ' OUTPUTS - None
- '
- '==========================================================
- Sub ErrorHandler (ByVal sModuleInfo As String, ByVal nErrNo As Integer, ByVal sErrorText As String)
-
- ' Report the error.
- MsgBox "An error occurred in " & sModuleInfo & "." & " The error was " & sErrorText, MB_OK Or MB_ICONSTOP, "Error"
-
- ' Treat all errors as fatal in this demo. Terminate the app.
- End
-
- End Sub
-
- '==========================================================
- '
- ' Function - CenterWindow
- '
- ' Author - Peter J. Morris. TMS Ltd.
- '
- ' Date Written: #### Date - 16/11/94 Time - 03:11
- '
- ' Purpose - See function purpose.
- '
- ' Revisions:
- ' BY WHY AFFECTED
- ' Peter J. Morris. TMS Ltd. Original code.
- '
- '
- ' INPUTS - frm -> Form to use.
- '
- '
- ' OUTPUTS - None
- '
- '==========================================================
- Sub CenterWindow (frm As Form)
- '==========================================================
- '
- ' Form: MODGEN.BAS Procedure: CenterWindow
- '
- ' Author - Peter J. Morris. TMS Ltd.
- ' Template fitted: #### Date - 16/11/94 Time - 03:11
- '
- ' Copyright and status if any: Copyright ⌐ TMS 1994,1995
- ' All rights reserved. Status @BLUE@TMS.DEMO@COLD
- '
- ' Purpose/Description In brief:
- '
- '=========================================================
-
- ' Set up general error handler
-
- On Error GoTo Error_CenterWindow:
-
- ' ========== Code Starts.==========
-
-
- Dim nNewX As Integer
- Dim nNewY As Integer
-
- nNewX = (Screen.Width - frm.Width) / 2
- nNewY = (Screen.Height - frm.Height) / 2
-
- frm.Move nNewX, nNewY
-
-
- ' ========== Code Ends .==========
-
- Exit Sub
-
- ' Error handler
- Error_CenterWindow:
-
- ' Call general error handler
-
- ErrorHandler "MODGEN.BAS/CenterWindow", Err, Error$
-
- ' Default resume behaviour: exit this sub/func
-
- Resume Exit_CenterWindow:
-
- Exit_CenterWindow:
-
-
- End Sub
-
-